import request from '@/utils/request'

export function spiderTable(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/flow/table`,
    method: 'get',
    params: query
  })
}

export function spiderRun(id) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/flow/run/${id}`,
    method: 'post'
  })
}

export function spiderCron(id, cron) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/flow/cron`,
    method: 'post',
    data: {
      id: id,
      cron: cron
    }
  })
}

export function spiderDelete(id) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/flow/delete/${id}`,
    method: 'post'
  })
}

export function spiderNoticeLoad(id) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/notice/load/${id}`,
    method: 'get'
  })
}

export function spiderNoticeSave(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_ADMIN_API}/api/spider/notice/save`,
    method: 'post',
    data: query
  })
}
